import requests
import os

class PackageBotApi:
    def __init__(self):
        pass

    def package_bot(self, url):
        headers = {
            'Connection': 'keep-alive',
            'Accept': '*/*',
            'Accept-Encoding': 'gzip, deflate, br',
        }
        try:

            # 必须是单引号
            file_path = r'C:\Users\15054\Desktop\90eff8e4-9f01-4061-a67a-793f18d91111.zip'
            # script_dir = os.path.dirname(os.path.abspath(__file__))
            # file_path = os.path.join(script_dir, 'package.bot')
            with open(file_path, 'rb') as f:
                file_data = f.read()

            response = requests.put(url, headers=headers, data=file_data)

            print(f"package_bot Status Code: {response.status_code}")
            print(f"package_bot Response Text: {response.text}")
        except Exception as e:
            print(f"Error reading file: {e}")


if __name__ == '__main__':
    PackageBotApi().package_bot()
